package com.ja.openchat.views.bubble;

import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.ja.openchat.R;
import com.ja.openchat.ui.chat.adapter.ConversationMessageAdapter;

import java.util.List;

import kotlin.Triple;

public class OnMessageAttachAdapter extends BaseQuickAdapter<Triple<String,Integer, ConversationMessageAdapter.ContextMenuItemWrapper>, BaseViewHolder> {

    public OnMessageAttachAdapter(@Nullable List<Triple<String, Integer, ConversationMessageAdapter.ContextMenuItemWrapper>> data) {
        super(R.layout.xpopu_adapter_text_customer, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, Triple<String, Integer, ConversationMessageAdapter.ContextMenuItemWrapper> item) {
        holder.setText(R.id.tv_text, item.getFirst());
        ImageView imageView = holder.getViewOrNull(R.id.iv_image);
        imageView.setBackgroundResource(item.getSecond());
        holder.setGone(R.id.bottom_line,holder.getAdapterPosition()==(getData().size()-1));
    }
}
